
$DataStore = function(){
	this.fieldsConfig=new HashMap();
	this.recordConfig=new HashMap();
	this.storeConfig=new HashMap();
};

$DataStore.prototype.setFields=function(key,flds){
	this.fieldsConfig.put(key,flds);
};

$DataStore.prototype.setRecords=function(key,data){
	this.recordConfig.put(key,data);
};

$DataStore.prototype.getStore=function(storeKey){
	return this.storeConfig.get(storeKey);
};

$DataStore.prototype.get=function(storeKey){
	return this.getStore(storeKey);
};

$DataStore.prototype.add=function(name,flds,data){
	var fldConfig = null;
	if(typeof(flds)=="undefined" || (!flds)){
		fldConfig = this.fieldsConfig.get(name);
	}else if(typeof(flds)=="string"){
		fldConfig = this.fieldsConfig.get(flds);
	}else{
		fldConfig = flds;
		this.fieldsConfig.put(name,flds);
	}
	
	var records = null;
	if(typeof(data)=="undefined" || (!data)){
		records = this.recordConfig.get(name);
	}else if(typeof(data)=="string"){
		records = this.recordConfig.get(flds);
	}else{
		records = data;
		this.recordConfig.put(name,data);
	}
	
	var store=new Ext.data.SimpleStore({fields: fldConfig});
		store.loadData(records);
	this.storeConfig.put(name,store);
	return store;
};


$dataStore = new $DataStore();
$dataStore.setFields("onlyCode",["code"]);
$dataStore.setFields("codeText",["code","text"]);

